package com.shuaqiu.sboot.login;

import com.shuaqiu.sboot.system.user.bean.UserBo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.Date;

@Mapper
@Repository
public interface LoginMapper {

    @Select("SELECT * FROM sys_user WHERE account = #{account}")
    UserBo selectUser(final String account);

    @Update("UPDATE sys_user SET lastLoginTime = #{lastLoginTime} WHERE account = #{account}")
    boolean updateLoginTime(@Param("account") final String account,
                            @Param("lastLoginTime") final Date lastLoginTime);
}
